p = [5,0;4,3;3,4;0,5;-3,4;-4,3;-5,0;-4,-3;-3,-4;0,-5;3,-4;4,-3;5,0];
%反算控制点
InputsStruct.data = p;
InputsStruct.k = 3;
InputsStruct.ctrPnums = 13;
InputsStruct.w = ones(1,InputsStruct.ctrPnums);
InputsStruct.x = linspace(0,1,100);
InputsStruct.dataPara = Parametrization(InputsStruct).CM;
InputsStruct.knots = GetKnots(InputsStruct).UAVG();
%拟合曲线
InputsStruct.data = InvCtrP(InputsStruct);
InputsStruct.dataPara = Parametrization(InputsStruct).CM;
InputsStruct.knots = GetKnots(InputsStruct).UAVG;
Q = NURBS(InputsStruct);
%显示优化
figure(1)
plot(Q(:,1),Q(:,2))
% figure(2)
% C = Curvature(Q);
% plot(InputsStruct.x, C);
%反插节点

Untitled5(InputsStruct.knots,InputsStruct.data(:,1),InputsStruct.data(:,2),InputsStruct.w);




